package com.nexus.plugin.amqp.annotion;

import com.rabbitmq.client.BuiltinExchangeType;
import org.springframework.stereotype.Component;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 发送消息注解
 *
 * @Date 2025/9/24 21:01
 * @Author luzhengning
 **/
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Component
public @interface RabbitSender {
    /**
     * 交换机名称
     *
     * @Date 2025/9/24 21:01
     * @Author luzhengning
     **/
    String exchange() default "";

    /**
     * 路由键
     *
     * @Date 2025/9/24 21:01
     * @Author luzhengning
     **/
    String routingKey() default "";

    /**
     * 队列名称
     *
     * @Date 2025/9/24 21:01
     * @Author luzhengning
     **/
    String queue() default "";

    /**
     * 是否持久化
     *
     * @Date 2025/9/24 21:01
     * @Author luzhengning
     **/
    boolean persistent() default true;

    /**
     * 消息过期时间，单位(秒)
     *
     * @Date 2025/9/26 23:27
     * @Author luzhengning
     **/
    int ttl() default -1;

    /**
     * 交换机类型
     *
     * @Date 2025/9/25 03:58
     * @Author luzhengning
     **/
    BuiltinExchangeType exchangeType() default BuiltinExchangeType.DIRECT;

    /**
     * 该队列最大存放消息数量
     * @Date 2025/9/27 00:25
     * @Author luzhengning
     **/
    int maxLength() default -1;
}
